package com.zx.ishopping.controller.User;


import com.zx.ishopping.results.Result;
import com.zx.ishopping.services.CartItemsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 购物车商品控制类
 * 在未生成订单时，购物车内商品数量不会影响商品库存
 */

@RestController
@RequestMapping("/user/cartItems")
public class CartItemsController {
    
    @Autowired
    private CartItemsService cartItemsService;
    
    
    /**
     * 向购物车添加购商品
     * @param productId
     * @return
     */
    @PostMapping("/addCartItems")
    public Result addCartItems(Long productId ){
        cartItemsService.addCartItems(productId);
        return Result.success();
    }
    
    
}
